package com.xunan.demo.controller;

import com.xunan.demo.service.WechatUserService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@CrossOrigin
@RestController
public class WechatUserController {

    @Resource
    private WechatUserService wechatUserService;

    /**
     * 获取用户的OpenId
     *
     * @return 用户的OpenId
     */
    @GetMapping("/wechat-user/getUserOpenId")
    public String getUserOpenId(@RequestParam String loginCode) {
        return wechatUserService.getUserWechatOpenId(loginCode);
    }

}
